home *** CD-ROM | disk | FTP | other *** search
- program examp2;
-
- {$Ipchr.i } { The include file that contains the definitions of the }
- { character graphics routines. THE SPACES AFTER THE .i }
- { EXTENSION MUST BE INCLUDED }
-
- var
- shapes : charset;
- window1,window2,window3 : charmessage;
- { Note: if you want to save space, the definition }
- { of CHARMESSAGE can be changed to a smaller array }
- i,m,n,p,errno,delay,delta : integer;
- { loop indices and such }
- ch : char; { a character for user response }
-
- begin { main program }
- errno := readcset(shapes,'slotmchn.chr');
- { read the character set }
- if errno <> -1 then { if all is ok }
- begin
- graphcolormode; { set 320 x 200 graphics }
- gotoxy(1,20);
- writeln('Press the Space Bar to roll again');
- { let the user know what to do }
- getvect; { save the system vector }
- setvect(shapes); { and put in our own }
- for i := 0 to 4 do { set up the bells and whistles (and cherries }
- begin { and lemons and... }
- window1[i] := i; { use these characters }
- window2[i] := i+10;
- window3[i] := i+20;
- end;
- for i := 0 to 4 do
- begin
- copychar(shapes,window1[i],window2[i]);
- { copy the pictures from window1 to window 2 }
- copychar(shapes,window1[i],window3[i]);
- { and window 3 }
- end;
- repeat { now do the display }
- i := 8*(random(11)+5);
- { spin window 1 5 to 15 times (8 rows/char) }
- m := i+8*(random(6)+5);
- { window 2 spins a little longer }
- n := m+8*(random(6)+5);
- { and window 3 longer yet }
- printcolumn(5,10,window1,1,3);
- { display the initial characters }
- printcolumn(5,15,window2,1,3);
- printcolumn(5,20,window3,1,3);
- { Note: for displaying 1 character, gratchar }
- { could also be used. }
- { e.g. gratchar(5,x,windowx[0],3) }
- delay := 0; { start off fast }
- repeat
- if i <> 0 then { each window rolls its own number of times }
- begin
- columndown(shapes,window1,5); { roll window }
- i := i-1; { count it }
- if i = 0 then
- delay := delay+50;
- { if this window is not going to roll }
- { anymore, make up for the processing }
- { time lost not updating it }
- end;
- if m <> 0 then { this looks just like the previous one }
- begin
- columndown(shapes,window2,5);
- m := m-1;
- if m = 0 then
- delay := delay+50;
- end;
- columndown(shapes,window3,5);
- n := n-1; { the 3rd window needs no fancy processing, as we }
- { know it will be spinning to the very end }
- for delta := 0 to delay do ; { waste a little time }
- delay := delay+10; { waste a little more time next time }
- printcolumn(5,10,window1,1,3); { update the windows }
- printcolumn(5,15,window2,1,3);
- printcolumn(5,20,window3,1,3);
- until n = 0; { end of inner repeat loop }
- read(kbd,ch); { get the users response }
- until ch <> ' '; { and repeat until it is not a space }
- restorevect; { put the system vector back }
- textmode; { restore the regular screen }
- end; { of the if statement }
- end. { end of the program }
-